function showLoding() {
	var name = document.getElementsByName("file")[0].value;

	var type = name.substring(name.lastIndexOf('.') + 1, name.length);

	if (type != "xls") {
		alert("上传的文件必须为EXCEL文件");
		return;
	}

	window.parent.document.getElementById("lodingDiv").style.height = window.parent.document.body.clientHeight
			- 3 + "px";
	window.parent.document.getElementById("lodingDiv").style.display = '';

	document.getElementById("importForm").submit();
}
var up_doc = window.dialogArguments.document;

function $2(name) {
	return window.dialogArguments.document.getElementsByName(name);
}

function getParentTR(dom) {
	if (dom) {
		if (dom.tagName.toLowerCase() == 'tr') {
			return dom;
		} else {
			return getParentTR(dom.parentNode);
		}
	} else {
		return null;
	}
}

function writeToForm() {
	
	var length = data.length;
	var numberArray = $2("my:预算编号");
	var formLength = numberArray.length;
	var trNode = getParentTR(numberArray[formLength - 1]);

	for (var i = 0; i < length; i++) {
		trNode.id = "oper";
		window.dialogArguments.addEmpty();
	}

	for (var i = 0; i < formLength; i++) {
		getParentTR($2("my:预算编号")[0]).id = "oper";
		window.dialogArguments.del();
	}

	for (var i = 0; i < length; i++) {
		$2("my:预算编号")[i].value = data[i].number;
		$2("my:项目名称")[i].value = data[i].name;
		$2("my:预算金额")[i].value = data[i].cost;
		$2("my:部门")[i].value = data[i].dept;
		$2("my:车间")[i].value = data[i].dept_child;
	}
	window.close();
}